<script setup lang="ts">
import { provide } from "vue"
import { Form, FormProps } from "ant-design-vue"
import { formContextKey } from "./context"

export type Props = FormProps & {
  layout?: "horizontal" | "vertical" | "inline"
}

const props = defineProps<Props>()

const slots = defineSlots<InstanceType<typeof Form>["$slots"]>()

provide(formContextKey, props)
</script>

<template>
  <Form v-bind="props">
    <template v-for="key in Object.keys(slots)" :key="key" #[key]="params">
      <slot :name="key" :key="key" v-bind="params"></slot>
    </template>
  </Form>
</template>
